<?php include 'includes/header.php';?>
<?php include 'includes/bar.php';?> 
<!--Start MainContent Wrapper-->
<div class="maincontentWrapper">

<?php include 'includes/sidenav.php';?>
<?php include 'includes/categorynav.php';?>

<script type="text/javascript">
function validateForms(){
	//alert("HERE");
	//alert($("#privacyAndPolicyId").checked());
	if(!document.getElementById("privacyAndPolicyId").checked){
		alert("Please Agree to Privacy and Policy");
		return false;
	}

	//alert("AS GIFT : " + document.getElementById("sendasgift").checked);
	if(document.getElementById("sendasgift").checked){
		message = "";
		if(document.getElementById("receipient_fullname").value== ""){
	   		message += "Receipient Full Name is Required\n";
	   	}
		if(document.getElementById("receipient_email").value== ""){
			message += "Receipient Email is Required\n";
	   	}
		if(document.getElementById("receipient_address").value.trim() == ""){
			message += "Receipient Address is Required\n";
	   	}
	   	
	   	if(message != ""){
		   	alert("Please Fill Up Required Fields:\n\n" + message);
		   	return false;
	   	}


	}
		
		
	return true;
}
</script>
  <!--Start ProductContainer-->
  	   <?php if (isset($deals)): ?>
       <div class="miniMasthead"><img src="/__assets/mcchampdeals/images/masthead.png" /></div>
      <?php endif;?>

			 <?php if (isset($deals)): ?>
                    <?php foreach($deals as $deal){ ?>
			        <div class="productContainer">
			        <div id="productContent">
						<table width="100%" border="0" cellspacing="0" cellpadding="0">
			           <tr>
						<td width="38%" valign="top">
						<img src="/__assets/mcchampdeals/images/item.jpg" width="242" height="210" class="img" /></td>
						<td width="62%" height="248" valign="top">
						<div id="productPrice">
							<p>Item Code:<?=$deal->code;?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 			<?=$deal->name;?></p></div>
							
							<div id="Price">
							<p>Price : Php <?=$deal->price;?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;    Save:   <?=$deal->discount;?>%</p>
						   
						   <p class="productinfo"><?=$deal->description;?>
						   <br><br>
						   <table width="100%">
						   <tr>
						   	   <td>
							   		<a href="<?=DEALURL?>/view/<?=$deal->id;?>" >
								    <img src="/__assets/mcchampdeals/images/buy.jpg" >
								    
								    
								   </a>
							   </td>
							   <td>
							   <?php if(isset($deal->ishotdeal) && $deal->ishotdeal == 1):?>
							   			<blink><b>This is HOT DEAL</b></blink>
							   <?php endif;?>
							   </td>
						    </tr>
						  </table>
						   </p>
						   
						   
						  
						   <p id="productOffer">
						   Remaining  Items:  <?=$deal->quantity;?> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Offers Ends at:    	<?=$deal->deal_end_date;?></p>
						   
						</div>
						</td>
					   <td width="0%"></td>
					   </tr>
			   		  </table>
					</div>
			        <!--end of ProductContainer-->
			       </div>
                    <?php }?>
			<?php endif; ?> 
			
			
			<?php if (isset($individualdeal)): ?>
			
				<div class="productContainer">
				        <div id="productContent">
							<table width="100%" border="0" cellspacing="0" cellpadding="0">
			              <tr>
		              
						<td width="100%" height="800" valign="top">
						
						<form action="<?=DEALURL?>/confirmcheckoutdetails/<?=$individualdeal->id;?>" method="post" onsubmit="return validateForms()">
						
						<div id="productPrice" style="width: 98%">
							<p>Item Code:<?=$individualdeal->code;?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 			<?=$individualdeal->name;?></p></div>
							
						  <div id="Price" style="width: 98%">
								<p>Price : Php <?=$individualdeal->price;?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;    Save:   <?=$individualdeal->discount;?>%</p>
							   
							   <p class="productinfo" style="width: 98%"><?=$individualdeal->description;?>
							   <br><br>
					        <table width="100%">
							   <tr>
							   	   <td>
								   </td>
								   <td>
								   <?php if(isset($individualdeal->ishotdeal) && $individualdeal->ishotdeal == 1):?>
								   			<blink><b>This is HOT DEAL</b></blink>
								   <?php endif;?>
								   </td>
						      </tr>
					      </table>
						      <table width="100%" align="center" cellpadding="3" cellspacing="4" style="color: #4D4D4D; font:normal 15px arial;">
			   	  			    <tr>
								   		<td colspan="3"></td>
							   	</tr>
								   	<tr>
								   	  <td colspan="3" valign="top" ><h3 style="color:#000;"><u>Customer Details</u></h3></td>
						   	     </tr>
						   	     <?php 
						   	     /*
								$this->session->set_userdata('transaction_modeofpayment', $this->input->post('modeofpayment',TRUE));
								$this->session->set_userdata('transaction_sendasgift', $this->input->post('sendasgift',TRUE));
								$this->session->set_userdata('transaction_client_id', $this->input->post('client_id',TRUE));
								$this->session->set_userdata('transaction_receipient_fullname', $this->input->post('receipient_fullname',TRUE));
								$this->session->set_userdata('transaction_receipient_address', $this->input->post('receipient_address',TRUE));
								$this->session->set_userdata('transaction_receipient_notes', $this->input->post('receipient_notes',TRUE));
								$this->session->set_userdata('transaction_tenant_id', $this->input->post('tenant_id',TRUE));
							    */  	   
						   	     ?>
						   	     
								   	<tr>
								   	  <td width="22%" valign="top" ><input type="checkbox" id="sendasgift" name="sendasgift" value="true" <?=(($this->session->userdata('transaction_sendasgift') == "true" || $this->session->userdata('transaction_sendasgift') == true) )?"checked":""?> > Send as a Gift</td>
								   	  <td width="23%" valign="top">Receipient Fullname :</td>
								   	  <td width="55%" valign="top"><input type="text" name="receipient_fullname" id="receipient_fullname" value="<?=($this->session->userdata('transaction_receipient_fullname')!=null)?$this->session->userdata('transaction_receipient_fullname'):''?>" /><strong style="color:red"> *</strong></td>
						   	     </tr>
								   	<tr>
								   		<td >&nbsp;</td>
								   		<td valign="top">Email address :</td>
								   		<td valign="top"><input type="text" name="receipient_email" id="receipient_email"  value="<?=($this->session->userdata('transaction_receipient_email')!=null)?$this->session->userdata('transaction_receipient_email'):''?>" /><strong style="color:red"> *</strong></td>
								   	</tr>
								   	<tr>
								   		<td >&nbsp;</td>
								   		<td valign="top">Address:</td>
								   		<td valign="top"><textarea name="receipient_address" id="receipient_address" cols="30" rows="3"><?=($this->session->userdata('transaction_receipient_address')!=null)?$this->session->userdata('transaction_receipient_address'):''?></textarea><strong style="color:red"> *</strong></td>
								   	</tr>

						    </table>
						      ____________________________________________<br />
						    <?php if($this->session->userdata("transaction_modeofpayment")!=null):?>
						    <table width="100%" align="center" cellpadding="3" cellspacing="4" style="color: #4D4D4D; font:normal 15px arial;">
			   	  			    	<tr>
								   		<td valign="top">Customer Full Name :</td>
								   		<td valign="top"><input type="text" name="client_fullname"  value="<?=($this->session->userdata('transaction_client_fullname')!=null)?$this->session->userdata('transaction_client_fullname'):''?>" /></td>
								   	</tr>
								   		<tr>
								   		<td valign="top">Email address :</td>
								   		<td valign="top"><input type="text" name="client_email"  value="<?=($this->session->userdata('transaction_client_email')!=null)?$this->session->userdata('transaction_client_email'):''?>" /></td>
								   	</tr>
								   	<tr>
								   		<td valign="top">Address:</td>
								   		<td valign="top"><textarea name="client_address" cols="30" rows="3"><?=($this->session->userdata('transaction_client_address')!=null)?$this->session->userdata('transaction_client_address'):''?></textarea></td>
								   	</tr>
			   	  		    </table>
			   	  		    <?php elseif(isset($addressbook)):?>
			   	  		    <table width="100%" align="center" cellpadding="3" cellspacing="4" style="color: #4D4D4D; font:normal 15px arial;">
			   	  			    	<tr>
								   		<td valign="top">Customer Full Name :</td>
								   		<td valign="top"><input type="text" name="client_fullname"  value="<?=$addressbook->firstname." ".$addressbook->lastname?>" /></td>
								   	</tr>
								   		<tr>
								   		<td valign="top">Email address :</td>
								   		<td valign="top"><input type="text" name="client_email"  value="<?=$this->session->userdata('client_email');?>" /></td>
								   	</tr>
								   	<tr>
								   		<td valign="top">Address:</td>
								   		<td valign="top"><textarea name="client_address" cols="30" rows="3"><?=$addressbook->address1?></textarea></td>
								   	</tr>
			   	  		      </table>
			   	  		    
			   	  		    
			   	  		    <?php endif;?>
						      ____________________________________________<br />
						    <table width="100%" align="center" cellpadding="3" cellspacing="4" style="color: #4D4D4D; font:normal 15px arial;">
						      		<tr>
								   		<td valign="top">Notes</td>
								   		<td valign="top">
								   		<textarea name="transaction_notes" cols="30" rows="3"><?=($this->session->userdata('transaction_notes')!="")?$this->session->userdata('transaction_notes'):''?>
								   		</textarea></td>
								   	</tr>
			   	  		    </table>
						      
						      
                               
                               <br />
							   <table width="90%" align="center">
							     <tr>
							       <td width="151" valign="top" style="color: #4D4D4D; font:normal 15px arial"><?php if(isset($tenant)):?>Tenant Name:</td>
							       <td width="472" valign="top" style="color: #4D4D4D; font:normal 15px arial"><?=$tenant->name?></td>
						         </tr>
							     <tr>
							       <td valign="top" style="color: #4D4D4D; font:normal 15px arial">Tenant Desription:</td>
							       <td valign="top" style="color: #4D4D4D; font:normal 15px arial"><?=$tenant->description?></td>
						         </tr>
							     <tr>
							       <td valign="top" style="color: #4D4D4D; font:normal 15px arial">Tenant Address:</td>
							       <td valign="top" style="color: #4D4D4D; font:normal 15px arial"><?=$tenant->address?>
							         <br />
							         <?php endif;?></td>
						         </tr>
						      </table>
							   <br>
					      <table cellpadding="4" cellspacing="8" style="color: #4D4D4D; font:normal 15px arial; width:100%">
								   	<tr>
								   		<td width="31%" valign="top" style="font:strong">Select Mode of Payment</td>
								   	</tr>
							   		<tr>
							   			<td height="40" valign="middle"><input type="radio" name="modeofpayment" value="onlinepayment" checked>Credit Card</td>
					   			    <td width="24%" valign="middle"><input type="radio" name="modeofpayment" value="banktransfer">Bank Transfer</td>
						   			  <td width="45%" valign="middle"><input type="radio" name="modeofpayment" value="westernunion">Western Union</td>
							   		</tr>
							   		<tr>
							   			<td height="32" colspan="2" valign="middle" ><input type="checkbox" id="privacyAndPolicyId"> 
                                        I have read and agree to <a href="{url}/privacyplicy" target="_blank">Privacy Polcy</a> <input type="submit" value="Continue" name="confirmDeal" class="btn"/></td>
                                        <td valign="middle"></td>
							   		</tr>
			
						     </table>
						     </p>
							</div>
							
							</form>
						</td>
					   <td width="0%"></td>
					   </tr>
					   
				     </table>
					</div>
			        <!--end of ProductContainer-->
			       </div>
			<?php endif; ?> 

	
      <!--End of Main content Wrapper-->
      </div>
<!--end of rightpane-->
<div></div>
<?php include 'includes/footer.php'; ?>